package top.liujingyanghui.crypto.tkmybatis.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;
import top.liujingyanghui.crypto.mybatis.annotation.CryptoClass;
import top.liujingyanghui.crypto.mybatis.annotation.CryptoString;
import top.liujingyanghui.crypto.mybatis.enums.CryptoMode;
import top.liujingyanghui.crypto.tkmybatis.rule.IdNumCryptoRule;
import top.liujingyanghui.crypto.tkmybatis.rule.PhoneCryptoRule;

/**
 * @author : wdh
 * @since : 2022/5/23 16:14
 */
@Data
@CryptoClass    // 标识这个实体中有属性需要加解密
@EqualsAndHashCode(callSuper = true)
public class User extends BaseEntity { // BaseEntity中已经实现Serializable，这里就不需要实现了

    private String name;

    // 标识这个属性需要加解密，设置加解密的规则为手机号
    @CryptoString(rule = PhoneCryptoRule.class, mode = CryptoMode.ALL)
    private String phone;

    // 标识这个属性需要加解密，设置加解密的规则为身份证号
    @CryptoString(rule = IdNumCryptoRule.class, mode = CryptoMode.ALL)
    private String idNum;
}
